package com.kfyang.manualgear.generator.impl.jdbc.constant;

/**
 * java 语句
 */
public interface StatementConstants {
    // 简单增删改查
    String RETURN_MODIFY_RESULT = "return jdbcTemplate.update(sql, parameters.toArray())";
    String QUERY_BEGIN_ONE = "return jdbcTemplate.queryForObject(sql, (rs, rowNum) ->";
    String QUERY_BEGIN_MANY = "return jdbcTemplate.query(sql, (rs, rowNum) ->";

    // 通用方法
    String JDBC_MODIFY_STATEMENT = "jdbcTemplate.update(sql.toString(), parameters.toArray())";
    String QUERY_RETURN_STATEMENT = "return $T.$L$L";

    String SQL_DEFINE = "String sql = \"";

    String ENTITY_SET_STATEMENT = "entity.$L($T.$L(rs, $S))";
    String GET_VALUE_STATEMENT = "$T $L = $T.$L(rs, $S)";
    String NEW_ENTITY_STATEMENT = "$T entity = new $T()";
    String FOR_ENTITY_LIST = "for ($T entity : entityList)";
    String RETURN_ENTITY = "return entity";
    String RETURN_ENTITY_BY_CONSTRUCT = "return new $T($L)";

    // 参数设置
    String ADD_ENTITY_VALUE = "parameters.add(entity.$L())";
    String ADD_NEW_OBJECT = "parameters.add(new $T())";

    String INSERT_LISTS = "repeatSeparatedByComma($S, entityList.size())";

    String LAMBDA_START = "(rs, rowNum) ->";
}
